from django.db import models
from dingxiang.utils.models import BaseModel
from users.models import UserModel


# Create your models here.

class PatientModel(BaseModel):
    GENDER_CHOICES = (
        (0, '男'),
        (1, '女')
    )
    # 怀孕
    PREGNANT_CHOICES = (

        (0, '无'),
        (1, '怀孕中'),
        (2, '哺乳中')
    )
    gender = models.SmallIntegerField(choices=GENDER_CHOICES, null=True, blank=True, verbose_name='性别')
    birth = models.DateField(blank=True, null=True, verbose_name='出生日期')
    weight = models.DecimalField(max_digits=5, decimal_places=2, blank=True, null=True, verbose_name='体重')
    #     过敏史
    is_allergy = models.BooleanField(null=True, blank=True, verbose_name="是否有过敏史")
    allergy = models.TextField(blank=True, null=True, verbose_name="过敏史")
    #     过往病史
    is_history = models.BooleanField(null=True, blank=True, verbose_name="是否有过往病史")
    history = models.TextField(blank=True, null=True, verbose_name="过往病史")
    #     肝功能
    is_liver = models.BooleanField(null=True, blank=True, verbose_name="是否有肝功能异常")
    #     肾功能
    is_kidney = models.BooleanField(null=True, blank=True, verbose_name="是否有肾功能异常")
    # 不同用户展示不同的登录信息
    pregnant = models.SmallIntegerField(choices=PREGNANT_CHOICES, default=0, null=True,blank=True,verbose_name='孕期状态')
    user = models.ForeignKey(UserModel, on_delete=models.DO_NOTHING, verbose_name='用户')

    class Meta:
        db_table = 'patient'
        verbose_name = "患者信息"
        verbose_name_plural = verbose_name
